package zhongbo.java.air.monitor.web;//package zhongbo.java.air.dictionary.web.controller;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//import zhongbo.java.air.dictionary.model.AirAlertZone;
//import zhongbo.java.air.dictionary.service.AirAlertZoneService;
//
//import javax.annotation.Resource;
//import javax.validation.Valid;
//import java.util.List;
//
///**
// * 警戒区域配置表(AirAlertZone)表控制层
// *
// * @author makejava
// * @since 2025-03-31 14:06:00
// */
//@RestController
//@RequestMapping("airAlertZone")
//@Api(tags = "警戒区域服务")
//public class AirAlertZoneController {
//    /**
//     * 服务对象
//     */
//    @Autowired
//    private AirAlertZoneService airAlertZoneService;
//
//    /**
//     * 分页查询
//     *
//     * @param PageNum 页码
//     * @param PageSize      大小
//     * @return 查询结果
//     */
//    @GetMapping
//    @ApiOperation(value = "分页查询", notes = "根据查询消息分页返回列表")
//    public Page<AirAlertZone> queryByPage(@RequestParam Integer PageNum, @RequestParam Integer PageSize){
//        return airAlertZoneService.queryByPage(PageNum, PageSize);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @GetMapping("{id}")
//    @ApiOperation(value = "用户查询", notes = "通过主键查询单条数据")
//    public ResponseEntity<AirAlertZone> queryById(@PathVariable("id") String id) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.queryById(id));
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param airAlertZone 实体
//     * @return 新增结果
//     */
//    @PostMapping
//    @ApiOperation(value = "新增数据", notes = "新增单条数据")
//    public ResponseEntity<AirAlertZone> add(@RequestBody @Valid AirAlertZone airAlertZone) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.insert(airAlertZone));
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param airAlertZone 实体
//     * @return 编辑结果
//     */
//    @PutMapping
//    @ApiOperation(value = "修改数据", notes = "修改单条数据")
//    public ResponseEntity<AirAlertZone> edit(@RequestBody @Valid AirAlertZone airAlertZone) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.update(airAlertZone));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键
//     * @return 删除是否成功
//     */
//    @DeleteMapping
//    @ApiOperation(value = "删除数据", notes = "删除单条数据")
//    public ResponseEntity<Boolean> deleteById( String id) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.deleteById(id));
//    }
//    /**
//     * 获取所有数据
//     *
//     * @return 查询结果
//     */
//    @GetMapping("all")
//    @ApiOperation(value = "获取所有数据", notes = "获取所有数据")
//    public ResponseEntity<List<AirAlertZone>> queryAll(){
//        return ResponseEntity.ok(this.airAlertZoneService.queryAll());
//    }
//    /**
//     * 获取坐标
//     * */
//    @GetMapping("coordinates/{id}")
//    @ApiOperation(value = "获取坐标", notes = "获取坐标")
//    public ResponseEntity<String> getCoordinates(@PathVariable("id") String id) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.getCoordinates(id));
//    }
//    /**
//     * 获取类型
//     * */
//    @GetMapping("type/{id}")
//    @ApiOperation(value = "获取类型", notes = "获取类型")
//    public ResponseEntity<String> getType(@PathVariable("id") String id) throws Exception {
//        return ResponseEntity.ok(this.airAlertZoneService.getType(id));
//    }
//
//}
//


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import zhongbo.java.air.common.vo.PageVo;
import zhongbo.java.air.common.vo.ResultVo;
import zhongbo.java.air.monitor.model.AirAlertZone;
import zhongbo.java.air.monitor.service.AirAlertZoneService;


/**
 * 说明：
 *
 * @author 钟波dellNotebook
 * @since 2025年04月01日 星期二 23:25:02
 */
@RestController
@RequestMapping("airAlertZone")
@Api(tags = "警戒区域配置接口")
public class AirAlertZoneController {

    @Autowired
    private AirAlertZoneService<AirAlertZone> airAlertZoneService;

    @PostMapping("add")
    @ApiOperation("添加")
    ResultVo<AirAlertZone> add(@RequestBody AirAlertZone entity) throws Exception {
        AirAlertZone airAlertZone = airAlertZoneService.add(entity);
        return ResultVo.ok(airAlertZone);
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    ResultVo<String> delete(String entityId) throws Exception {
        String delete = String.valueOf(airAlertZoneService.delete(entityId));
        return ResultVo.ok(delete);
    }

    @PostMapping("edit")
    @ApiOperation("修改")
    ResultVo<AirAlertZone> edit(@RequestBody AirAlertZone edit) throws Exception {
        AirAlertZone airAlertZone = airAlertZoneService.edit(edit);
        return ResultVo.ok(airAlertZone);
    }

    @GetMapping("findOne")
    @ApiOperation("查询一条")
    ResultVo<AirAlertZone> findOne(String entityId) throws Exception {
        AirAlertZone airAlertZone = airAlertZoneService.findOne(entityId);
        return ResultVo.ok(airAlertZone);
    }
    @GetMapping("findPage")
    @ApiOperation("分页查询列表")
    ResultVo<PageVo<AirAlertZone>> findPage(Integer page, Integer pageSize
            , String keyword, String fields
            , String oderByField, Boolean orderByAsc) {
        PageVo<AirAlertZone> pageVo = airAlertZoneService.findPage(page, pageSize, keyword, fields, oderByField, orderByAsc);
        return ResultVo.ok(pageVo);
    }

}
